<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<jsp:include page="header.jsp" />
<div class="section" style="min-height: 80vh">
	<div class="container">
		<div class="row">
			<div class="col-md-4"></div>
			<div class="col-md-4">
				<form action="${ContextPath}login" method="post" id="form1"
					class="form-horizontal">
					<div class="form-group">
						<div class="col-sm-12 text-left" style="font-size: 24px">
							用户登录<br/> <span style="color: red;font-size:12px;">${ERROR_VCODE}</span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label" for="name">用户名</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" name="username"
								id="username" required>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label" for="name">密码</label>
						<div class="col-sm-9">
							<input type="password" class="form-control" name="password"
								id="password" required>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label" for="name">验证码</label>
						<div class="col-sm-9">
							<img src="${ContextPath}vcode" id="vcodeimg" /> 点击图片刷新
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label" for="name">填写验证码</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" name="vcode" id="vcode"
								required>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-12 text-right">
							<button class="btn btn-primary btn-lg" type="button"
								id="btnSubmit">登录</button>
								<a href="${ContextPath}forget.jsp">忘记密码？找回密码</a>
						</div>
					</div>
				</form>
			</div>
			<div class="col-md-4"></div>
		</div>
	</div>
</div>
<script>
	$(document).ready(function() {
		$("#vcodeimg").click(function() {
			$(this).attr("src", "${ContextPath}vcode?" + new Date());
		});
		$("#btnSubmit").click(function() {
			var uname = $("#username").val();
			var upass = $("#password").val();
			var vcode = $("#vcode").val();
			if (uname.length == 0 || upass.length == 0 || vcode.length == 0) {
				alert("表单填写不完整！");
				return;
			} else {
				$("#form1").submit();
			}
		});
	});
</script>
<jsp:include page="footer.jsp" />